<div class="uk-padding-small uk-text-center">
    <p>微信支付</p>
    <h1 class="uk-margin-remove" style="font-size: 4rem;">￥{$getData.money}</h1>
</div>
<div class="dux-box">
    <form class="dux-form uk-form   dux-form dux-form-right">
        <div class="uk-input-group">
            <span class="uk-input-group-label">收款方</span>
            <div class="uk-form-controls uk-form-controls-text">{$site.info_name}</div>
        </div>
        <div class="uk-input-group">
            <span class="uk-input-group-label">支付单号</span>
            <div class="uk-form-controls uk-form-controls-text">{$getData.order_no}</div>
        </div>
        <div class="uk-input-group">
            <span class="uk-input-group-label">支付项目</span>
            <div class="uk-form-controls uk-form-controls-text">{$getData.body}</div>
        </div>
    </form>
</div>
<div class="uk-padding-small uk-text-center">
    <button class="uk-button uk-button-primary uk-button-block" id="pay" disabled type="button">微信系统支付中...</button>
</div>


<script type="text/javascript" charset="utf-8">

    var url = '{$data.url}';
    function onBridgeReady() {
        $('#pay').attr('disabled', true).text('微信系统支付中...');
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest', {
                "appId": "{$data.appId}",
                "timeStamp": "{$data.timeStamp}",
                "nonceStr": "{$data.nonceStr}",
                "package": "{$data.package}",
                "signType": "{$data.signType}",
                "paySign": "{$data.paySign}"
            },function(res) {
                if( res.err_msg == "get_brand_wcpay_request:ok"){
                    window.location.href = url;
                    return;
                }
                if( res.err_msg == "get_brand_wcpay_request:fail"){
                    alert(res.err_msg);
                }
                $('#pay').attr('disabled', false).text('支付订单');
            });
    }

    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }
    $('#pay').click(function () {
        onBridgeReady();
    });


</script>